import { ref, reactive } from 'vue';

export function useActions() {
  const acState = reactive({
    detailVisible: false,
    editVisible: false,
    removeVisible: false,
    loading: false,
    modalText: "确定要删除该项吗",
    current: {},
  })


  const showEdit = (e) => {
    acState.editVisible = true
    e.id && (acState.current = e)
  }

  const showDetail = (e) => {
    acState.detailVisible = true
    e.id && (acState.current = e)
  }

  const showRemove = (e) => {
    acState.removeVisible = true
    e.id && (acState.current = e)
  }


  return {
    acState,
    showEdit,
    showDetail,
    showRemove
  }
}